﻿using JT808.Protocol.Extensions.JTActiveSafety.Metadata;
using JTActiveSafety.Gateway;
using JTActiveSafety.Gateway.Abstractions;
using JTActiveSafety.Gateway.Services;
using JTActiveSafety.Gateway.Sessions;
using JTActiveSafety.Protocol;
using JTActiveSafety.Protocol.Extensions;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Demo.AttachFileService
{


    //public class AttachFileHandlerWorker : BackgroundService
    //{
    //    private readonly ILogger _logger;
    //    private readonly IJTActiveSafetyMsgConsumer _jT1078MsgConsumer;
    //    private readonly IAttachFileStorageService _fileService;
 
    //    public AttachFileHandlerWorker(ILogger<AttachFileHandlerWorker> logger,
    //        IJTActiveSafetyMsgConsumer msgConsumer,
    //        IAttachFileStorageService fileService)
    //    {
    //        _logger = logger;
    //        _jT1078MsgConsumer = msgConsumer;
    //        _fileService = fileService;
    //    }
    //    protected override Task ExecuteAsync(CancellationToken stoppingToken)
    //    {
    //        _jT1078MsgConsumer.OnMessage((Message) =>
    //        {
    //            _logger.LogDebug($"写入数据,{Message.SIM}");
    //            _fileService.WriteData(Message.SIM, Message.Data);
    //        });
    //        return Task.CompletedTask;
    //    }
    //}
}
